﻿<%@ Page Language="C#" MasterPageFile="~/Template/GUEST.Master" AutoEventWireup="true" CodeBehind="sanphamtheoloaisanpham.aspx.cs" Inherits="BTN04.GUEST.SanPhamTheoLoaiSanPham" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphMenuTrai" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cplContent" runat="server">
    <div id="title_content">
    <div style="width:280px; float:left;">
         <div id="title_left_content">
        </div>
        <div id="title_mid_content"> 
            <asp:Label ID="lblLoaiSanPham" runat="server" Text=">> SẢN PHẨM"></asp:Label>
        </div>
        <div id="title_right_content">
        </div>
    </div>
    <div style="float:left; text-align:right; padding-right:25px; padding-top:5px; color:#FFEF84; width:310px;">
        Xem thêm <img src="../Images/dot02.gif" />                                        
    </div>
       
    </div>
    <div id="mid_content">           
       
        <asp:Repeater ID="Repeater2" runat="server" 
            DataSourceID="SanPhamTheoLoaiSanPhamPhanTrang">
            <HeaderTemplate>
                <ul id="ul">
            </HeaderTemplate>
            <ItemTemplate>
                <li id="li">
                    <div style="clear:both; display:block;">
                        <div id="top_sanpham">
                        </div>
                        <div id="mid_sanpham">
                             <div style="width:172px; margin-left:10px; margin-left:10px; padding-top:5px;">
                                 <a href="chitietsanpham.aspx?idSanPham=<%# Eval("MaSanPham")%>&idMaLoaiSanPham=<%# Eval("MaLoaiSanPham")%>">
                                 <img height="150px" 
                                     src="../<%# Eval("HinhAnh") %>" width="172px" /></a>
                            </div>
                            <div id="ten_sanpham" style="font-size:larger;">
                                <a class="link" href="chitietsanpham.aspx?idSanPham=<%# Eval("MaSanPham")%>&idMaLoaiSanPham=<%# Eval("MaLoaiSanPham")%>">
                                     <%# Eval("TenSanPham")%></a>
                            </div>
                            <div id="gia_sanpham">Giá : <%# Eval("GiaBan") %>
                            </div>
                        </div>
                        <div id="bottom_sanpham">
                        </div>
                    </div>
                </li>  
            </ItemTemplate>
            <FooterTemplate>
             </ul>
             <div style="color:blue; text-align:center; clear:both;"> Trang &nbsp;
           <%
               BTN04.BUS.SanPhamBUS spBUS = new BTN04.BUS.SanPhamBUS();
               int maloai = Convert.ToInt32(Request.QueryString["id"]);
               int soluongsanpham = spBUS.SoLuongSanPhamTheoLoaiSanPham(maloai);
               int sosanphamchomoitrang = 12;
               int sotrang = soluongsanpham / sosanphamchomoitrang + 1;
               int page = Convert.ToInt32(Request.QueryString["page"]);
               for(int i=1; i<=sotrang;i++)
               {
               %>
                   <a class="phantrang" href="sanphamtheoloaisanpham.aspx?id=<% Response.Write(maloai); %>&page=<%
                     Response.Write(i.ToString());%>&size=12">
                    <%
                     if(page == i)
                     {
                      %>
                        <span style="color:Red; text-decoration:underline;">
                        <% 
                         Response.Write(i.ToString()); 
                        %>
                        </span>                        
                      <%
                      }
                       else
                     {
                         Response.Write(i.ToString()); 
                     }             
                    %>
                   </a> &nbsp;
               <%
               }
            %>
              
           </div>
            </FooterTemplate>
        </asp:Repeater>
        <asp:ObjectDataSource ID="SanPhamTheoLoaiSanPhamPhanTrang" runat="server" 
            SelectMethod="DanhSachSanPhamTheoLoaiPhanTrang" TypeName="BTN04.BUS.SanPhamBUS">
            <SelectParameters>
                <asp:QueryStringParameter DefaultValue="2" Name="_maLoai" QueryStringField="id" 
                    Type="Int32" />
                <asp:QueryStringParameter DefaultValue="0" Name="page" QueryStringField="page" 
                    Type="Int32" />
                <asp:QueryStringParameter DefaultValue="12" Name="size" QueryStringField="size" 
                    Type="Int32" />
            </SelectParameters>
        </asp:ObjectDataSource>
        <asp:ObjectDataSource ID="SanPhamObjectDataSource1" runat="server" 
            SelectMethod="DanhSachSanPhamTheoLoai" TypeName="BTN04.BUS.SanPhamBUS">
            <SelectParameters>
                <asp:QueryStringParameter DefaultValue="1" Name="_maLoai" QueryStringField="id" 
                    Type="Int32" />
            </SelectParameters>
        </asp:ObjectDataSource>
       
    </div>
    <div id="bottom_content">
    </div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="cphMEnuPhai" runat="server">
</asp:Content>
